In order to better understand the background of the subject invention, explanation of certain terminology is first provided. A term well-known in the art as a symmetric multi-processor (SMP) refers to an aspect of hardware in a computing system and, more particularly, relates to the physical layout and design of the processor planar itself. Such multiple processor units have, as one characteristic, the sharing of global memory as well as equal access to I/O of the SMP system.
Another term which is commonly associated with modern complex computing systems is a "thread". The term "thread" in a general sense refers merely to a simple execution path through application software and the kernel of an operating system executing with the computer. As is well understood in the art, it is commonplace for multiple such threads to be allowed per a single process image.
A thread standard has now been incorporated into the POSIX standard. Basic thread management under the POSIX standard is described, for example, in a publication by K. Robbins and S. Robbins entitled Practical UNIX Programming--A Guide To Concurrency, Communication and Multi-threading, Prentice Hall PTR (1996).
Another concept which is utilized hereinafter in describing the invention is one of "locks" or "mutexes". It is typical in modern computing systems to have critical sections of code or shared data structures, such as shared libraries, whose integrity is extremely important to the correct operation of the system. Locks/mutexes are, in general, devices employed in software (or hardware) to "serialize" access to these critical sections of code and/or shared data structures.
Two types of locks are often encountered in the art, namely blocking locks and simple or "spin" locks. Blocking locks are of the form which cause a thread requesting the lock to cease being executable, e.g., to go to "sleep" as the term is employed in the art, if the lock is currently held by another thread. Spin locks, in contrast, do not put waiting threads to "sleep", but rather, the waiting threads execute a spin loop, and thus repeatedly continue to request the lock until it is freed by the current thread "owner". Blocking locks are typically used for large critical sections of code or if the operating system kernel must differentiate between threads requiring data structure read-only capability and threads requiring the capability to modify the data structure(s).
One other term to note is the concept of code being multithread-safe. Code is considered to be thread/MP-safe if multiple execution threads contending for the same resource or routine are serialized such that data integrity is insured for all threads. One way of effecting this is by means of the aforementioned locks.
By way of further background, one approach to shared and exclusive access control in a multiprocessor system is presented in U.S. Pat. No. 4,604,694, entitled "Shared and Exclusive Access Control". Briefly described, this patent employs a lockword to control access to a queue of the resource desired and indicates both the present use of the resource and a pointer to the most recently enqueued task in the queue. Methods using an atomic, double compare and swap operation allow a task requesting either exclusive or shared access of the resource to be enqueued, and allow tasks requiring either exclusive or shared access to the resource to suitably rearrange the queue and prepare access to the resource for other tasks. The approach is hardware dependent in that the method relies on the atomic double compare and swap operation of, for example, an IBM System/370 product. Unfortunately, many of today's multi-processing systems, such as an RS/6000 system offered by International Business Machines Corporation, lack this particular instruction capability.
Presently, thread locking employs standard POSIX mutex functions. These standard POSIX functions include pthread.sub.-- mutex.sub.-- lock and pthread.sub.-- mutex.sub.-- unlock which are described, for example, in the above-referenced publication by K. Robbins & S. Robbins entitled Practical UNIX Programming--A Guide to Concurrency, Communication and Multi-threading. These functions are designed to enhance portability of applications running on several operating systems. Unfortunately, the functions have the disadvantage of poor performance and are often inefficient for high performance libraries, such as a threaded message passing interface (MPI) library, particularly, since uncontested performance is the most important marketing and evaluation criterion.
Thus, a need exists in the art for a commercially enhanced approach to multithread-safe resource locking and unlocking in a multithread computer environment.